package com.zgc.view.svg;

import com.jfoenix.svg.SVGGlyph;
import javafx.scene.paint.Paint;

public enum SvgIconEnum {
    /** 关闭 */
    ICON_CLOSE(-1, "Close-Icon",
            "M12.453,10.062l27.49,27.49a1.69,1.69,0,0,1-2.39,2.39l-27.49-27.49A1.69,1.69,0,0,1,12.453," +
                    "10.062Zm27.49,0a1.69,1.69,0,0,1,0,2.39l-27.49,27.49a1.69,1.69,0,0,1-2.39-2.39l27.49-27.49A1.69," +
                    "1.69,0,0,1,39.943,10.062Z"),

    /** 左箭头 */
    ICON_RIGHT(-1, "Right-Icon",
            "M 742,-37 90,614 Q 53,651 53,704.5 53,758 90,795 l 652,651 q 37,37 90.5,37 53.5,0 90.5," +
                    "-37 l 75,-75 q 37,-37 37,-90.5 0,-53.5 -37,-90.5 L 512,704 998,219 q 37,-38 37,-91 0,-53 -37," +
                    "-90 L 923,-37 Q 886,-74 832.5,-74 779,-74 742,-37 z"),
    /** 右箭头 */
    ICON_LEFT(-1, "Left-Icon",
            "m 1099,704 q 0,-52 -37,-91 L 410,-38 q -37,-37 -90,-37 -53,0 -90,37 l -76,75 q -37,39 -37," +
                    "91 0,53 37,90 l 486,486 -486,485 q -37,39 -37,91 0,53 37,90 l 76,75 q 36,38 90,38 54,0 90,-38 l 652," +
                    "-651 q 37,-37 37,-90 z"),
    /** 箭头右 （实心） */
    ANGLE_RIGHT(-1,
            "ANGLE_RIGHT",
            "M340 548.571q0 7.429-5.714 13.143l-266.286 266.286q-5.714 5.714-13.143 5.714t-13.143-5.714l-28.571-28" +
                    ".571q-5.714-5.714-5.714-13.143t5.714-13.143l224.571-224.571-224.571-224.571q-5.714-5.714-5.714-13.143t5.714-13" +
                    ".143l28.571-28.571q5.714-5.714 13.143-5.714t13.143 5.714l266.286 266.286q5.714 5.714 5.714 13.143z"),

    ICON_ZK_STAT(-1, "ICON_ZK_STAT",
            "M166.4 768h691.2a38.4 38.4 0 0 1 38.4 38.4v51.2a38.4 38.4 0 0 1-38.4 38.4H166.4a38.4 38.4 0 0 " +
                    "1-38.4-38.4v-51.2a38.4 38.4 0 0 1 38.4-38.4zM192 128.576h640a64 64 0 0 1 64 64v448a64 64 0 0 1-64 " +
                    "64H192a64 64 0 0 1-64-64v-448a64 64 0 0 1 64-64z m183.808 136.256a12.8 12.8 0 0 0-12.8 12.8v61.248c0 " +
                    "7.04 5.76 12.8 12.8 12.8h133.44L361.408 503.04a38.4 38.4 0 0 0-10.88 26.88v54.016c0 7.04 5.76 12.8 12.8 " +
                    "12.8h305.024a12.8 12.8 0 0 0 12.8-12.8v-61.248a12.8 12.8 0 0 0-12.8-12.8H503.36l156.48-159.424a38.4 " +
                    "38.4 0 0 0 11.008-26.88v-45.888a12.8 12.8 0 0 0-12.8-12.8h-282.24z"),

    ICON_ZK_ROOT_DEMO(-1, "ZK_ROOT_DEMO",
            "M512 1024C229.232 1024 0 794.768 0 512 0 229.232 229.232 0 512 0c282.768 0 512 229.232 512 512 " +
                    "0 282.768-229.232 512-512 512z m0.536-29.792c266.2 0 482-215.8 482-482s-215.8-482-482-482-482 215.8-482 " +
                    "482 215.8 482 482 482zM367.216 712V278.408h162.304c88.088 0 132.132 35.84 132.132 107.52 0 26.756-7.472 " +
                    "51.12-22.412 73.092-14.944 21.976-35.5 38.82-61.672 50.54l141.8 202.44h-109.868l-107.52-177.248h-49." +
                    "8V712h-84.96z m84.96-236.72h20.8c65.432 0 98.148-26.464 98.148-79.392 0-38.672-29.2-58.008-87.6-58." +
                    "008h-31.348v137.4z");

    SvgIconEnum(int glyphId, String name, String svgPathContent) {
        this.glyphId = glyphId;
        this.name = name;
        this.svgPathContent = svgPathContent;
    }

    private final int glyphId;
    private final String name;
    private final String svgPathContent;

    public SVGGlyph init(Paint fill, double prefWidth, double prefHeight) {
        return init(this.glyphId, this.name, fill, prefWidth, prefHeight, true);
    }

    public SVGGlyph init(int glyphId, String name, Paint fill, double prefWidth, double prefHeight, boolean autosize) {
        SVGGlyph svgGlyph = new SVGGlyph(glyphId, name, this.svgPathContent, fill);
        if (prefWidth >= 0) {
            svgGlyph.setPrefWidth(prefWidth);
        }
        if (prefHeight >= 0) {
            svgGlyph.setPrefHeight(prefHeight);
        }
        if (autosize) {
            svgGlyph.autosize();
        }

        /*SVGPath svgPath = new SVGPath();
        svgPath.setContent(svgPathContent);
        svgPath.setId(String.valueOf(glyphId));
        svgPath.setFill(fill);
        svgPath.setStrokeWidth(prefWidth);
        if (autosize) {
            svgPath.autosize();
        }*/
        return svgGlyph;
    }


}
